package com.logistics.pick.mapper;

import com.logistics.erp.entity.domain.ErpInvReq;
import com.logistics.pick.entity.domain.PickAndErpInvbill;
import com.logistics.pick.entity.domain.PickDetail;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.logistics.pick.entity.domain.PickDetailInvBill;
import com.logistics.pick.entity.domain.PickQty;
import com.logistics.pick.entity.model.PickQuery;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 拣配明细 Mapper 接口
 * </p>
 *
 * @author yunjian.ban
 * @since 2024-06-28
 */
@Mapper
public interface PickDetailMapper extends BaseMapper<PickDetail> {

    /**
     * 根据站点查找物料明细
     * @param station
     * @return
     */
    List<Map> findStationPickList(@Param("station") String station);

    /**
     * 根据拣配单id查找出物料列表
     * @param pickId
     * @param container
     * @return
     */
    public List<PickDetail> findByPickId(String pickId, String container);

    /**
     * 根据退库单查找出已经绑定的物料
     * @param reqNo
     * @return
     */
    List<ErpInvReq> findMaterialReturnByReqNo(@Param("reqNo") String reqNo);

    /**
     * 查找物料信息
     * @param params
     * @return
     */
    PickDetail findPickDetail(Map<String, Object> params);

    /**
     * 查找拣配数量
     * @param params
     * @return
     */
    BigDecimal findTotalPickQty(Map<String, Object> params);

    /**
     * 根据托盘编号查找领料单号
     * @param params
     * @return
     */
    List<PickDetailInvBill> findMaterials(PickDetailInvBill params);

    /**
     * 根据托盘id查找优先级
     * @param containerId
     * @return
     */
    Integer findIsPriority(String containerId);

    /**
     * 查找拣配数量
     * @param pickId
     * @return
     */
    List<PickQty> findPickQty(String pickId);

    /**
     * 查找拣配数量
     * @param pickId
     * @return
     */
    List<PickQty> findPickQtyGroupBySeq(String pickId);

    /**
     * 根据物料编号查找装配班组是否配送过物料
     * @param pickId
     * @return
     */
    Integer findAssemblyByBillNo(Integer pickId);


    List<PickAndErpInvbill> findPickDetailInfoByPickId(PickQuery param);
}
